#include "Path.h"

FileSystem::Path::Path(const std::string &path)
    : m_Path(path)
{
}

fs::path FileSystem::Path::GetFilePath() const
{
    return m_Path;
}

std::string FileSystem::Path::String() const
{
    return m_Path.string();
}

std::string FileSystem::Path::GetFileName() const
{
    return m_Path.filename().string();

}

std::string FileSystem::Path::GetRelativePath() const
{
    return m_Path.relative_path().string();
}

std::string FileSystem::Path::GetAbsolutePath() const
{
    return fs::absolute(m_Path);
}

std::string FileSystem::Path::GetRelativeParentPath() const
{
    return m_Path.parent_path();
}

std::string FileSystem::Path::GetAbsoluteParentPath() const
{
    return fs::absolute(m_Path.parent_path());
}

bool FileSystem::Path::HasExtension() const
{
    return m_Path.has_extension();
}

std::string FileSystem::Path::GetExtension() const
{
    return m_Path.extension().string();

}

bool FileSystem::Path::HasStem() const
{
    return m_Path.has_stem();
}

std::string FileSystem::Path::GetStem() const
{
    return m_Path.stem();
}

void FileSystem::Path::MakePrefered()
{
    this->m_Path = m_Path.make_preferred().string();

}

bool FileSystem::Path::Exist() const
{
    return fs::exists(this->m_Path);
}

void FileSystem::Path::CreateDirectories() const
{
    fs::create_directories(this->m_Path);
}

void FileSystem::Path::CreateDirectory() const
{
    fs::create_directory(this->m_Path);
}

void FileSystem::Path::CopyTo(const fs::path &target)
{
    fs::copy(this->m_Path, target);
}

void FileSystem::Path::Remove()
{
    fs::remove(this->m_Path);

}

void FileSystem::Path::RemoveAll()
{
    fs::remove_all(this->m_Path);
    
}

void FileSystem::Path::Rename(const std::string &target)
{
    fs::rename(this->m_Path, target);
}
